home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6775 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.9 KB  |  97 lines

  1. Newsgroups: comp.sys.sgi.hardware,comp.lang.c++
  2. Path: zebedee.wormald.com.au!news
  3. From: troys@donald.wormald.com.au (Troy Stephen)
  4. Subject: Re: Help with serial/tty2 communication (write ok, read NOT).
  5. In-Reply-To: Tom Benoist's message of 28 Jan 1996 06:45:45 GMT
  6. Message-ID: <TROYS.96Feb12160640@donald.wormald.com.au>
  7. Sender: news@wormald.com.au (Login account for news)
  8. Nntp-Posting-Host: donald
  9. Organization: Wormald Technology, Sydney, Australia
  10. References: <4ebkuaINNdqp@retriever.cs.umbc.edu> <4ef62p$8t2@ni1.ni.net>
  11. Date: Mon, 12 Feb 1996 06:06:39 GMT
  12.  
  13.  
  14.  
  15. Hi guys,
  16.  
  17. I have a similar problem, and thought it might as well continue on this thread.
  18.  
  19. I am using a configuration almost exactly the same as the one you have
  20. suggested below.  The only differences being:
  21.     
  22.  port = open("/dev/ttyd2", O_RDWR);
  23.  
  24.  t.c_cc[VMIN] = 27;
  25.  t.c_cc[VTIME] = 0;
  26.  
  27. I'm reading 27 byte packets and I want the read to block until it gets
  28. a complete packet.  I think the man page mentions that with this
  29. configuration, it is possible for the read to block indefinitely,
  30. however I haven't witnessed this yet.  What I am seeing though, is that
  31. sometimes the read returns prematurely without all 27 bytes, and I need
  32. to send it back to get the rest. Why is this so?  What could be causing
  33. it to return early?
  34.  
  35. Also, I am a bit concerned about the reliability of the serial ports at
  36. high baud rates, especially when the man page for SERIAL(7) says:
  37.  
  38. "...Each line may be independently set to run at any of several speeds,
  39. as high as 19,200 or even 38,400 bps."
  40.  
  41. What are people's experience with this?  I need to run at 38.4kbaud and
  42. my application needs to read the 27 byte packets at 60hz.  What are my
  43. chances of getting this to work reliably?
  44.  
  45.  
  46. Regards,
  47. Troy Stephen
  48. troys@wormald.com.au
  49.  
  50. PS. I'm using a deskside ONYX with IRIX 5.2
  51.  
  52.  
  53.  
  54. In article <4ef62p$8t2@ni1.ni.net> Tom Benoist <ben@ifx.com> writes:
  55.  
  56. > From: Tom Benoist <ben@ifx.com>
  57. > Newsgroups: comp.sys.sgi.hardware,comp.lang.c++
  58. > Date: 28 Jan 1996 06:45:45 GMT
  59. > Organization: Interactive Effects
  60. > X-URL: news:4ebkuaINNdqp@retriever.cs.umbc.edu
  61. > Its pretty difficult to see what your doing wrong since,
  62. > 1. you didnt show your ioctl setup.
  63. > 2. You didnt mention if you understood the implications of O_NONBLOCK
  64. >    (ie...your reads return FALSE until a byte is available)
  65. > In any case, the following works for most applications.....
  66. > -Tom
  67. >     int port;
  68. >     struct termio t;
  69. >     port = open("/dev/ttyd2", O_RDWR | O_NDELAY, 0666);
  70. >     t.c_iflag = IGNBRK;
  71. >     t.c_oflag = 0;
  72. >     t.c_cflag = B38400 | CS8 | CREAD | CLOCAL;
  73. >     t.c_lflag = 0;
  74. >     t.c_cc[VMIN] = 1;
  75. >     t.c_cc[VTIME] = 1;
  76. >     t.c_iflag &=~(IXON | IXOFF | IXANY);
  77. >     ioctl(port, TCSETAW, &t);
  78. > -- 
  79. > _____________________________________________________________________
  80. > Tom Benoist                                        Email: ben@ifx.com 
  81. > Interactive Effects                      Amazon http://www.ifx.com/ie
  82.